program file1;

{$APPTYPE CONSOLE}

uses
  SysUtils,
  Math, windows, dialogs;

var
  n,i,ma,mi,g: integer;
  input: textFile;
begin
  assignFile(input,'input.txt');
  reset(input);
  readln(input,n);
  read(input,ma);
  mi:=ma;
  for i:= 0 to n-2 do
  begin
    read(input,g);
    ma:=max(ma,g);
    mi:=min(mi,g);
    writeln(chr(7));
  end;
  ShowMessage('sum = ' + IntToStr( ma+mi ));
  beep(1000,100);
  beep(5000,100);
  beep(1000,100);
  beep(2000,100);
  beep(5000,100);
end.
